package com.castle.fortress.admin.cms.fragment;

import com.castle.fortress.admin.cms.dto.CmsLinkDto;
import com.castle.fortress.admin.cms.service.CmsLinkService;
import com.castle.fortress.admin.utils.SpringUtils;
import org.beetl.core.tag.GeneralVarTagBinding;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * cms 友链 标签
 * @author castle
 */
public class CmsLinkTag extends GeneralVarTagBinding {

	@Override
	public void render() {
		Map<String,Object> map = new HashMap<>();
		//友链分类code
		if(containHtmlAttribute("gcode")){
			map.put("gcode",getAttributeValue("gcode"));
		}
		CmsLinkService cmsLinkService = SpringUtils.getBean(CmsLinkService.class);
		List<CmsLinkDto> list = cmsLinkService.cmsTagListCmsLink(map);
		this.binds(list);
		this.doBodyRender();
	}
}
